package com.snail.readyvr.rest;

import com.snail.readyvr.mvp.model.AccountInfo;
import com.snail.readyvr.mvp.model.BaseModel;
import com.snail.readyvr.mvp.model.ChangeHeadIconParam;
import com.snail.readyvr.mvp.model.ChangeNickNameParam;
import com.snail.readyvr.mvp.model.ChangePswParam;
import com.snail.readyvr.mvp.model.EmailFindPswParam;
import com.snail.readyvr.mvp.model.EmailRegisterParam;
import com.snail.readyvr.mvp.model.GetEmailVerifyCodeParam;
import com.snail.readyvr.mvp.model.GetTokenResponse;
import com.snail.readyvr.mvp.model.LoginParam;
import com.snail.readyvr.mvp.model.LoginResponse;
import com.snail.readyvr.mvp.model.PhoneRegisterParam;
import com.snail.readyvr.mvp.model.PhoneRegisterResponse;

import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.POST;
import retrofit2.http.Query;
import rx.Observable;

/**
 * Created by MRKING on 2016/4/25.
 * 网络请求简单封装
 * 使用retrofit + rxjava + okhttp
 */
public interface LoginRestClient {

    /**
     * 获取手机验证码
     * @param phoneNum
     * @param time
     * @return
     */
    @POST("app/mobile/verifycode")
    Observable<BaseModel<GetTokenResponse>> getPhoneVerifyCode(@Query("mobileNo") String phoneNum,@Query("requestTime") String time);

    /**
     * 手机号码注册
     * @param time
     * @param param
     * @return
     */
    @POST("app/mobile/register")
    Observable<BaseModel<PhoneRegisterResponse>> phoneRegister(@Query("requestTime") String time, @Body PhoneRegisterParam param);

    /**
     * 登录
     * @param param
     * @return
     */
    @POST("app/token")
    Observable<BaseModel<LoginResponse>> login(@Body LoginParam param);

    /**
     * 回收token
     * @param token
     * @return
     */
    @POST("app/recycle")
    Observable<BaseModel<LoginResponse>> logout(@Header("token") String token);


    /**
     * 手机号码找回密码
     * @param time
     * @param param
     * @return
     */
    @POST("app/mobile/modify")
    Observable<BaseModel<PhoneRegisterResponse>> phoneFindPsw(@Query("requestTime") String time, @Body PhoneRegisterParam param);

    /**
     * 邮箱注册
     * @param param
     * @return
     */
    @POST("app/email/register")
    Observable<BaseModel<PhoneRegisterResponse>> emailRegister(@Body EmailRegisterParam param);

    /**
     * 修改密码
     * @param param
     * @return
     */
    @POST("app/account/modify")
    Observable<BaseModel<PhoneRegisterResponse>> changePsw(@Body ChangePswParam param);

    /**
     * 获取邮箱验证码
     * @param param
     * @return
     */
    @POST("app/email/verifycode")
    Observable<BaseModel<PhoneRegisterResponse>> getEmailVerifyCode(@Body GetEmailVerifyCodeParam param);

    /**
     * 邮箱找回密码
     * @param param
     * @return
     */
    @POST("app/email/modify")
    Observable<BaseModel<PhoneRegisterResponse>> emailFindPsw(@Body EmailFindPswParam param);

    /**
     * 获取账户信息
     * @param token
     * @return
     */
    @GET("app/account/info")
    Observable<BaseModel<AccountInfo>> getAccountInfo(@Header("token") String token);

    /**
     * 修改昵称
     * @param token
     * @param param
     * @return
     */
    @POST("app/account/nickname/modify")
    Observable<BaseModel<LoginResponse>> changeNickName(@Header("token") String token, @Body ChangeNickNameParam param);

    /**
     * 修改头像
     * @param token
     * @param param
     * @return
     */
    @POST("app/account/headicon/modify")
    Observable<BaseModel<LoginResponse>> changeHeadIcon(@Header("token") String token, @Body ChangeHeadIconParam param);

}
